package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.model.vo.comment.request.*;
import com.ssy.lingxi.member.merchant.model.vo.comment.response.MemberOrderTradeCommentPageVO;
import com.ssy.lingxi.member.merchant.model.vo.comment.response.MemberTradeCommentDetailVO;
import com.ssy.lingxi.member.merchant.model.vo.comment.response.PlatformMemberTradeCommentPageVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.MemberDetailCreditCommentSummaryVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.MemberDetailCreditTradeHistoryVO;
import com.ssy.lingxi.member.merchant.service.web.IPlatformMemberCommentService;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @menu 平台后台-评价管理接口
 * @author 姚梓聪
 * @version 2.0.0
 * @date 2020/10/14
 */
@RestController
@RequestMapping("/member/platform/comment")
public class PlatformMemberCommentController {
    @Resource
    private IPlatformMemberCommentService platformMemberCommentService;

    /**
     * 平台后台-评价管理-会员评价查询分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/trade/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformMemberTradeCommentPageVO>> pagePlatformMemberTradeComment(@RequestHeader HttpHeaders headers, @Valid PlatformMemberTradeCommentQueryVO pageVO) {
        return platformMemberCommentService.pagePlatformMemberTradeComment(headers, pageVO);
    }

    /**
     * 平台后台-评价管理-交易评价汇总
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/trade/summary", method = RequestMethod.GET)
    public Wrapper<MemberDetailCreditCommentSummaryVO> pagePlatformMemberTradeCommentSummary(@RequestHeader HttpHeaders headers, @Valid PlatformMemberTradeCommentSummaryVO pageVO) {
        return platformMemberCommentService.getAllMemberDetailCreditTradeCommentSummary(headers, pageVO);
    }

    /**
     * 平台后台-评价管理-分页查询交易评论历史记录
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/trade/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDetailCreditTradeHistoryVO>> pagePlatformMemberTradeCommentHistory(@RequestHeader HttpHeaders headers, @Valid PlatformMemberTradeCommentHistoryVO pageVO) {
        return platformMemberCommentService.pagePlatformMemberTradeCommentHistory(headers, pageVO);
    }

    /**
     * 平台后台-评价管理-评价分页列表
     * @param headers Http头部信息
     * @param orderTradeCommentQueryVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/trade/history/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberOrderTradeCommentPageVO>> pageMemberOrderTradeCommentHistory(@RequestHeader HttpHeaders headers, @Valid MemberOrderTradeCommentQueryVO orderTradeCommentQueryVO) {
        return platformMemberCommentService.pageMemberOrderTradeCommentHistory(headers, orderTradeCommentQueryVO);
    }

    /**
     * 平台后台-评价管理-评价详情
     * @param headers Http头部信息
     * @param tradeCommentIdVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/trade/history/get", method = RequestMethod.GET)
    public Wrapper<MemberTradeCommentDetailVO> getMemberTradeCommentHistory(@RequestHeader HttpHeaders headers, @Valid MemberTradeCommentIdVO tradeCommentIdVO) {
        return platformMemberCommentService.getMemberTradeCommentHistory(headers, tradeCommentIdVO);
    }

    /**
     * 平台后台-评价管理-批量删除评价
     * @param headers Http头部信息
     * @param tradeCommentIdsVO 接口参数
     */
    @RequestMapping(value = "/order/trade/history/delete", method = RequestMethod.POST)
    public Wrapper<Void> getMemberTradeCommentHistory(@RequestHeader HttpHeaders headers, @RequestBody @Validated MemberTradeCommentIdsVO tradeCommentIdsVO) {
        return platformMemberCommentService.deletePlatformMemberTradeComment(headers, tradeCommentIdsVO);
    }

    /**
     * 平台后台-评价管理-屏蔽/显示评价
     * @param headers Http头部信息
     * @param updateStatusVO 接口参数
     */
    @RequestMapping(value = "/order/trade/history/update/status", method = RequestMethod.POST)
    public Wrapper<Void> updateStatusPlatformMemberTradeComment(@RequestHeader HttpHeaders headers, @RequestBody @Validated MemberTradeCommentUpdateStatusVO updateStatusVO) {
        return platformMemberCommentService.updateStatusPlatformMemberTradeComment(headers, updateStatusVO);
    }
}
